/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package vek.Objects;

import vek.ObjectCreation.ObjectCreator;
import vek.XML.parsedObjects.*;
import vek.XML.parsedObjects.ParsedAttractions;

/**
 * This class inherits from the POI class and contains overriden methods, 
 * which deal the data from part of the XML files.
 * This class contains the Addresse, facilities, website and opening hours.
 * All the POIs which are attractions are supposed to inherit from this class and thus inherit this class' behavior.
 * @author Christian, Michal og Jakob (Hold 1, gruppe 2)
 */
public abstract class POIAttraction extends POI{
    
    protected Addresse addresse;
    protected int phonenumber;
    protected String url;
    protected String urlShown;
    protected String email;
    protected Openinghours openinghours;
    protected String description;
    protected boolean toilets;
    protected boolean elevators;
    protected boolean handicapfriendly;
    
    /**
     * Creates a POIAttraction object and assigns its varaibles using data from the corrosponding ParsedObject.
     * @param pa the ParsedAttractions object which contains data from the XML files which this object is based on.
     */
    
    
    public POIAttraction(ParsedAttractions pa)
    {
        super( pa.parsedPOI );
        addresse = ObjectCreator.createAddresse(pa.parsedAddresse);
        phonenumber = pa.phonenumber;
        url = pa.url;
        urlShown = pa.urlShown;
        email = pa.email;
        openinghours = ObjectCreator.createOpeninghours(pa.parsedOpeninghours);
        description = pa.description;
        toilets = pa.toilets;
        elevators = pa.elevators;
        handicapfriendly = pa.handicapfriendly;
    }
    
    @Override
    public String toString()
    {
        String s = super.toString();
        
        s += " adresse: " + addresse.toString() + " phone: " + phonenumber 
                + " url: " + url + " showed url: " + urlShown + " emai " 
                + email + " opining hours: " + openinghours + " desc: " 
                + description + " toilets: " + toilets + " elevators: " 
                + elevators + " handicapfriendly " + handicapfriendly;
          
        return s;
    }
   
    
    public boolean phonenumberStartsWith(String s)
    {
        String pn = String.valueOf(phonenumber);
        if( pn.startsWith(s) )
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    
    public boolean isOpen(int day, int hour, int minute)
    {
        return openinghours.isOpen(day, hour, minute);
    }
    
    public Addresse getAddresse()
    {
        return addresse;
    }
    public int getPhoneNumber()
    {
        return phonenumber;
    }
    public String getURL()
    {
        return url;
    }
    public String getURLShown()
    {
        return urlShown;
    }
    public String getEmail()
    {
        return email;
    }
    public Openinghours getOpeninghours()
    {
        return openinghours;
    }
    public String getDescription()
    {
        return description;
    }
    public int hasToilets()
    {
        if(toilets)
        {
            return 1;
        }
        else
        {
        return 0;
        }
    }
    public int hasElevators()
    {
        if(elevators)
        {
            return 1;
        }
        else
        {
        return 0;
        }
    }
    public int isHandicapFriendly()
    {
        if(toilets)
        {
            return 1;
        }
        else
        {
        return 0;
        }
    }

}
